(function() {"use strict";var __module = CC_EDITOR ? module : {exports:{}};var __filename = 'preview-scripts/assets/script/Boost.js';var __require = CC_EDITOR ? function (request) {return cc.require(request, require);} : function (request) {return cc.require(request, __filename);};function __define (exports, require, module) {"use strict";
cc._RF.push(module, 'f04c0QSXYdGoIo7JPos1Jcw', 'Boost', __filename);
// script/Boost.js

"use strict";

/**
 * 直行道具撞破栅栏的一个视觉冲击动画
*/
cc.Class({
    extends: cc.Component,

    properties: {},
    onLoad: function onLoad() {
        var can = cc.find("Canvas");
        this.player = can.getChildByName("player");
    },

    //生成一对boost
    showBoost: function showBoost() {

        this.boost = this.node.parent.getChildByName("boost");
        this.GAP = 50;
        if (this.player.prop === "Rocket") {
            this.boostNode.getComponent("Boost").addInstantiate(cc.vv.res["boos"], -130 + parseInt(Math.random() * 60), this.GAP * this.boost.children.length, this.boost);
            this.boostNode.getComponent("Boost").addInstantiate(cc.vv.res["boos"], 160 + parseInt(Math.random() * 200), this.GAP * this.boost.children.length, this.boost);
        }
        // else if(this.player.prop === state){
        //     this.addInstantiate(cc.vv.res["boos"],x, y, this.boost);
        //      this.addInstantiate(cc.vv.res["boos"], x, y, this.boost);
        // }
    },
    addInstantiate: function addInstantiate(prefab, x, y, par) {
        var boom = cc.instantiate(prefab);
        boom.x = x;
        boom.y = y;
        par.addChild(boom);
    },


    // start () {},

    update: function update(dt) {
        //当人物不是火箭状态了并判断节点的长度，删除所有的boost节点
        this.boost = this.node.parent.getChildByName("boost");
        if (this.player.prop !== "Rocket" && this.boost.children.length > 0) {
            for (var i = 0; i < this.boost.children.length; i += 1) {
                this.boost.children[i].destroy();
            }
        }
    }
});

cc._RF.pop();
        }
        if (CC_EDITOR) {
            __define(__module.exports, __require, __module);
        }
        else {
            cc.registerModuleFunc(__filename, function () {
                __define(__module.exports, __require, __module);
            });
        }
        })();
        //# sourceMappingURL=Boost.js.map
        